﻿/*
* This software is the confidential and proprietary
* information of NetBay
* Such confidential information should not be disclosed
* NetBay copyright(c) 2011
*/
using System;
using System.ComponentModel;
using System.Data;
using NetBay.Core.Log;
using NetBay.Core.DataAccess;
using NetBay.Core.Extensions;

namespace Rio.Manager.DataAccess
{
    public class DA_NumerizationFoldersByDate
    {
        #region Enums
        public enum DbFunction
        {
            [DescriptionAttribute("")]

            None,
            [DescriptionAttribute("P_REPORT_MASS_IMPORT_TOTAL")]

            GetReportMassImportTotal,
            [DescriptionAttribute("P_REPORT_MASS_IMPORT_BY_DATE")]

            GetReportMassImportByOperatorByDate,
        }

        #endregion

        #region Function

        /// <summary>
        /// Get numerization resum by operator
        /// </summary>
        /// <param name="StartDate">Starting Date</param>
        /// <param name="endDate">endingDate</param>
        /// <returns></returns>
        public static IDataReader GetNumerizationReportByOperatorByDate(long userId, DateTime startDate, DateTime endDate)
        {
            try
            {
                LogManager.Instance().LogDebug("(p_lUserId<" + userId.ToString() + ">)(p_dStartDate<" + startDate.ToString() + ">)(p_dEndDate<" + endDate.ToString() + ">)");
                var db = DbHelper.DataBase;

                var dbCommand = db.GetNewCommand(DbFunction.GetReportMassImportByOperatorByDate.szGetDescription());
                db.AddInParameter(dbCommand, "p_lUserId", DbType.Int64, userId);
                db.AddInParameter(dbCommand, "p_dStartDate", DbType.String, startDate.ToShortDateString());
                db.AddInParameter(dbCommand, "p_dEndDate", DbType.String, endDate.ToShortDateString());

                return db.ExecuteReader(dbCommand);
            }
            catch (Exception ex)
            {
                LogManager.Instance().LogError("DA_NumerizationFoldersByDate --> GetNumerizationReportByOperatorByDate exception[" + ex.Message + "]");
                return null;
            }
        }
        #endregion
    }
}